﻿using System;
using AppCommon;
using Model;


public partial class admincenter_AdminPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session[Constants.S_ADMIN_USER] != null)
            {
                // Ok
                var user = (User) Session[Constants.S_ADMIN_USER];
                litUsername.Text = user.UserName;
            }
            else
            {
                Response.Redirect("~/admincenter/");
            }
        }
    }

    protected void OnClick(object sender, EventArgs e)
    {
        // Thuc hien logout
        // 1. Remove session
        Session.Remove(Constants.S_ADMIN_USER);
        // 2. Redirect den trang login
        Response.Redirect("~/admincenter/");
    }
}
